package com.itheima.b_operator;

/**
 * 目标：学习逻辑运算符
 * <p>
 * &    |    !    ^    &&    ||
 */
public class Demo07 {

    public static void main(String[] args) {
        int m = 10;
        double n = 13.14;
        int i = 8;

        //&:与、并且，左右两边都是true，结果才是true
        System.out.println(m > n & m > i);   //false & true--->false
        System.out.println(m > n | m > i);   //false | true--->true
        System.out.println(!(m > n));      // !false--->true
        System.out.println(m > n ^ m > i);   //false ^ true--->true

        //演示&和&&的区别
        System.out.println(m > n & m++ > i);   //false & true--->false,m=11
        System.out.println(m > n && m++ > i);   //false & true--->false,m=10，&&右边不执行，短路
        System.out.println("m = " + m);
    }
}
